{% extends "FOSUserBundle::layout.html.twig" %}
{% block head %}
{{parent()}}
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") == false %}
	<meta http-equiv="refresh" content="1; url={{path('cadss_test_homepage')}}" />
	<script type="text/javascript">
            window.location.href = "{{ path('fos_user_security_login') }}"
    </script>
{% endif %}
{% endblock head %}

{% block fos_user_content %}
	{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}	
		 {% for flashMessage in app.session.flashbag.get('message') %}
        <div class="toast">
            {{ flashMessage }}<img src="{{ asset('img/close.png') }}" witdh="16" height="16" onclick="this.parentNode.style.display='none'"/>
        </div>
        {% endfor %}
		<menu>
			<ul>
				<li><a href="{{path('cadss_test_keywords')}}">Keywords</a></li>
				<li>
					{{ form_start(form) }}
					{{ form_widget(form.searchterm) }}
					{{ form_widget(form.search) }}
					{{ form_end(form) }}
				</li>
				<li><a onclick="openPopUp('{{ path('cadss_test_addkeyword') }}');">Add Keyword</a></li>
				<!--<li><a href="{{ path('cadss_test_addkeyword') }}" >Add Keyword</a></li>-->
				<li><a href="{{ path('cadss_test_homepage') }}">Manage Documents</a></li>
				<li><a href="{{ path('fos_user_security_logout') }}">{{ 'layout.logout'|trans({}, 'FOSUserBundle') }}</a></li>
			</ul>
		</menu>
		<br />
		<br />
		<div id="keywords">
			<table width="1000">				
				{% for row in keywords |batch(4) %}
				<tr>
                	{% for keyword in row %}                    
					<td width="25%">{{keyword.keyword }}			
						<a href="{{ path('cadss_test_homepage', {'id': keyword.id}) }}">
							More info
						</a>
					</td>                    
                   {% endfor %}
				</tr>
				{% endfor %}
			</table>
		</div>		
    {% endif %}
{% endblock fos_user_content %}
